home *** CD-ROM | disk | FTP | other *** search
- -- 2000.02.26
- -- Clive Green <clivegreen@atlas.co.uk>
-
- ------------------------------------------------------------------------------------------------------
-
- -- this displays the main logo within MIAW, using some positional data stored in the data castlib.
-
- ------------------------------------------------------------------------------------------------------
-
- -- declare properties:
- property main -- main code directory object
- property logoName -- the reference symbol for the logo to be used
- property maskSuffix -- suffix string used to identify windowType mask bitmaps
- property miawFileName -- the director movie file name to open
- property miawMaskName -- the member name of a 1-bit bitmap used to define a custom windowType
- property miawMaskMember -- the member number of miawMaskName
- property miawRect -- the onscreen position of the miaw
- property logoVisible -- boolean indicating whether logoMiaw is currently visible
- property miaw -- a reference to the Director MIAW entity
-
- ------------------------------------------------------------------------------------------------------
-
- on new me,L
-
- -- (1) extract and check arguments:
-
- -- check for a parameter list:
- if ilk(L) <> #propList then return [#error:#noParamListSupplied, #msg:"mainLogoService:new"]
-
- -- a reference to the parent codebase is REQUIRED:
- main = L[#main]
- if (ilk(main) <> #instance) then return [#error:#noMainObjectSupplied, #msg:"mainLogoService:new"]
-
- --------------------
-
- -- (2) how are my logo elements named and numbered?
- logoName = #mainLogo
- maskSuffix = "MiawMask"
-
- miawMaskName = logoName & maskSuffix
- miawMaskMember = member(miawMaskName).number
-
- --------------------
-
- -- (3) set/obtain my logo's positioning data:
-
- dm = main.getDataManager()
- L = dm.getData([#set:#settings, #item:#mainLogo])
-
- if ilk(L) <> #propList then L = [:]
-
- -- what is the top-left corner of my miaw?
- x = L[#top]
- if voidP(x) then x = 0
-
- y = L[#left]
- if voidP(y) then y = 0
-
- --------------------
-
- -- (4) obtain my logo's filepath:
-
- -- what is the reference to the miaw filePath to be used?
- n = L[#filePathRef]
-
- -- resolve n to the filePath string of the miaw we want:
- dL = dm.getData([#set:#filePaths, #item:n])
- f = dL[#filePath]
-
- -- parse filepath for the current platform:
- um = main.getUtilityMethods()
- f = um.parseFilePath(f)
-
- -- prefix the filePath with the root directory path:
- r = dm.getRootPath()
-
- -- finally - store the compiled filePath:
- miawFileName = (r & f)
-
- --------------------
-
- -- (5) use the windowMask bitmap to determine the window dimensions:
- n = member(miawMaskName).number
- dx = member(n).width
- dy = member(n).height
-
- -- store the miaw onscreen position to be used:
- miawRect = rect(x,y,x+dx,y+dy)
-
- --------------------
-
- -- (6) initialise the logo miaw visibility flags:
- logoVisible = 0
-
- -- pass back my address:
- return me
-
- ----------------------------------------------------------------------------------------------------
-
- on showLogo me
-
- -- first check that there is enough room for the logo to be safely shown:
-
- -- assume the logo goes in the extreme topleft corner of the screen -- is there enough space there?
- if (miawRect.width > the stageLeft) and (miawRect.height > the stageTop) then
-
- -- the logo miaw can be taller than the vertical gap above the stage, OR
- -- wider than the horizontal gap to the left of the stage - but not both:
- return [#error:#notEnoughRoomForMiaw, #msg:"mainLogoService:showLogo"]
-
- end if
-
- --------------------
-
- -- use buddyAPI to verify the existence of the miaw file:
- xm = main.getXtrasManager()
- buddy = xm.getBuddyAPIxtra()
- if (ilk(buddy) <> #instance) then return ¬
- [#error:#xtraControllerMissing, #msg:"mainLogoService:showLogo needs buddyAPIxtra"]
-
- -- now check that the miaw file exists -- exit WITHOUT ERROR if it doesn't:
- f = buddy.fileExists(miawFileName)
- if not stringP(f) then return 0
-
- --------------------
-
- -- reference the logo miaw movie:
- miaw = window(miawFileName)
-
- -- use a custom windowType (this works in Projectors only):
- miaw.windowType = member(miawMaskMember)
-
- -- position window area, and open:
- miaw.rect = miawRect
- open miaw
-
- -- flag logo is 'visible':
- logoVisible = 1
-
- ----------------------------------------------------------------------------------------------------
-
- on clearLogo
-
- -- clean up and close logo window as neeeded:
- if not(logoVisible) then return 0
-
- close miaw
- forget miaw
-
- -- flag logo is 'invisible':
- logoVisible = 0
-
- ----------------------------------------------------------------------------------------------------